<template>
  <div class="rights_container">
    <div class="header">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>权限管理</el-breadcrumb-item>
        <el-breadcrumb-item>权限列表</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <el-card class="box-card">
      <el-table :data="rightsList" style="width: 100%" border stripe>
        <el-table-column label="#" type="index"></el-table-column>
        <el-table-column label="权限名称" prop="authName"></el-table-column>
        <el-table-column label="路径" prop="path"></el-table-column>
        <el-table-column label="权限等级">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level ==0">一级权限</el-tag>
            <el-tag v-else-if="scope.row.level ==1" type="success">二级权限</el-tag>
            <el-tag v-else-if="scope.row.level ==2" type="info">三级权限</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
  import connector from '../../base/interface.js';
  export default {
    name: "Rights",
    data(){
      return{
        rightsList:[]
      }
    },
    methods:{
      getRightsList(){
        /*获取所有权限列表*/
        connector.getRightsList().then(res=>{
          var {data:data}=res;
          this.rightsList=data.data;
        })
      }
    },
    created() {
      this.getRightsList();
    }
  }
</script>

<style lang="scss" scoped>
  .rights_container{
    .box-card{
      box-shadow:0 2px 2px rgba(0,0,0,0.15);
    }
  }
</style>
